<template>
  <s-modal
    title="新增"
    :visible="visible"
    width="800px"
    ok-text="保存"
    :confirm-loading="confirmLoading"
    :closable="!confirmLoading"
    @ok="save()"
    @cancel="()=>{if(!confirmLoading){ visible=false }}"
  >
    <div style="height:400px">
      <s-scroll>
        <s-form ref="form" :value="formValue">
          <s-form-item
            label="序号"
            size="middle"
            name="bugId"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入序号"
              v-model="formValue.bugId"
              />
          </s-form-item>
          <s-form-item
            label="问题类型"
            size="middle"
            name="problemType"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入问题类型"
              v-model="formValue.problemType"
              />
          </s-form-item>
          <s-form-item
            label="问题描述"
            size="middle"
            name="problemDescribe"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入问题描述"
              v-model="formValue.problemDescribe"
              />
          </s-form-item>
          <s-form-item
            label="姓名"
            size="middle"
            name="name"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入姓名"
              v-model="formValue.name"
              />
          </s-form-item>
          <s-form-item
            label="联系方式"
            size="middle"
            name="phone"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入联系方式"
              v-model="formValue.phone"
              />
          </s-form-item>
          <s-form-item
            label="时间"
            size="middle"
            name="createTime"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入时间"
              v-model="formValue.createTime"
              />
          </s-form-item>
          <s-form-item
            label="处置"
            size="middle"
            name="status"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入处置"
              v-model="formValue.status"
              />
          </s-form-item>

        </s-form>
      </s-scroll>
    </div>
  </s-modal>
</template>

<script>

export default {
  name: 'Add',
  emits: ['change'],
  data() {
    return {
      formValue: {},
      confirmLoading: false,
      visible: false
    }
  },
  methods: {
    open() {
      this.formValue = {}
      this.visible = true
    },
    save() {
	  const _this=this
      const form = this.$refs.form
      form.validate((values,fullValue) => {
		
        this.confirmLoading = true
        this.$api.PUT('/modules/operateBug/insert', values).then(res => {
          this.confirmLoading = false
          this.visible = false
          this.$emit('success');
          this.$message.info(res.msg)
        }).catch(() => {
          this.confirmLoading = false
        })
      })
    }
  }
}
</script>

<style lang="less" scoped>

</style>